<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="./imgNew13.css" />
    <script src="../imgNew3/jquery-1.12.4.js"></script>
    <title>轮播图</title>
  </head>

  <body>
    <div class="parentContainer">
      <div class="itemList"></div>
    </div>
    <div id="btn">
      <div class="left">←</div>
      <div class="right">→</div>
    </div>

    <script src="./imgNew13.js"></script>
    <script>
      let wrapList = []
      let i = 6
      for (let index = 0; index < 6; index++) {
        var obj = {
          header: '标题' + (index + 1),
          img: '../imgNew2/articleImg/image' + (index + 1) + '.jpg'
        }
        wrapList.push(obj)
      }
      wrapList.push({
        header: '标题1',
        img: '../imgNew2/articleImg/image1.jpg'
      })
      wrapList.unshift({
        header: '标题6',
        img: '../imgNew2/articleImg/image6.jpg'
      })
      console.log(wrapList)
      function buildWrapImgs(wrapList) {
        var item = ''
        for (let index = 0; index < wrapList.length; index++) {
          item += `<div class='item'><img src=${wrapList[index].img} alt=${wrapList[index].header} /><div>${wrapList[index].header}</div></div>`
        }
        $('.itemList').html(item)
      }
      buildWrapImgs(wrapList)
      next()
    </script>
  </body>
</html>
